<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>04_动画操作-隐藏侧边栏广告</title>
  <style>
    .box{
      position: fixed;
      bottom: 0;
      right: 0;
    }
    img{
      vertical-align: bottom;
    }

    .close{
      position: absolute;
      top: 0;
      right: 0;
      width: 25px;
      height: 25px;
      cursor: pointer;
    }

  </style>
</head>
<body>

  <div class="box">
    <span class="close"></span>
    <div class="top">
      <img src="./images/top.png" alt="">
    </div>
    <div class="bottom">
      <img src="./images/bottom.png" alt="">
    </div>
  </div>

  <script src="../libs/jquery-3.6.0.js"></script>
  <script>

    $(function() {
      let $close = $('.close')

      $close.click(function() {
        console.log(11);
        let $box = $(this).parent()
        $box.animate({
          top: '302px'
        }, 800)
        $box.animate({
          right: '-319px'
        }, 400)

      })
    })

  </script>
  
</body>
</html>




